package stripsLanguage;


public class Binding {

	/** which predicate's this binding is **/
	private Predicate EffectPredicate;
	
	/** for which variable this binding holds **/ 
	private Predicate PreconditionPredicate;
	
	/** id of step, that has effect in EffectPredicate **/
	private int IdOfEffectPredicateStep;

	/** id of step, that has effect in EffectPredicate **/
	private int IdOfPreconditionPredicateStep;
	
	public Binding(
		Predicate effectPredicate,
		Predicate preconditionPredicate,
		int idOfEffectPredicateStep,
		int idOfPreconditionPredicateStep)
	{
		PreconditionPredicate = preconditionPredicate;
		EffectPredicate = effectPredicate;
		IdOfEffectPredicateStep = idOfEffectPredicateStep;
		IdOfPreconditionPredicateStep = idOfPreconditionPredicateStep;
	}

	public Predicate getEffectPredicate() {
		return EffectPredicate;
	}

	public int getIdOfEffectPredicateStep() {
		return IdOfEffectPredicateStep;
	}
	
	public Predicate getPreconditionPredicate() {
		return PreconditionPredicate;
	}

	public int getIdOfPreconditionPredicateStep() {
		return IdOfPreconditionPredicateStep;
	}
	
	public String toString()
	{
		/*return "(" + EffectPredicate.getIdOfPredicate()
		+ "," + EffectPredicate.getName() + " -> "
		+ PreconditionPredicate.getIdOfPredicate() + ","
		+ PreconditionPredicate.getName() + ") ";*/
		try {
			return "(" + EffectPredicate.toString(false)
					+ " -> "
					+ PreconditionPredicate.toString(false) + ") ";
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
	}
}
